package com.bjqh.edu.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.bjqh.edu.Bean.Grade;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/9/15.
 */

public class Send2Adapter extends FragmentStatePagerAdapter {
    private List<Fragment> list;//因为要用将fragment加入到viewpager之中,所以内容为fragment类型的集合
    private List<Grade.RowsBean> gradebean;//设置底部tablayoutout显示文字
    public Send2Adapter(FragmentManager fm,List<Fragment> list,List<Grade.RowsBean> gradebean) {
        super(fm);
        this.list = list;
        this.gradebean=gradebean;
    }

    @Override
    public Fragment getItem(int position) {
        return list.get(position);
    }

    @Override
    public int getCount() {
        return list.size();
    }

   @Override//tablayout和viewpager结合之后,创建底部title使用的方法
    public CharSequence getPageTitle(int position) {
        return gradebean.get(position).getName();
    }
}
